Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: QuickTime Components

Previous | Overview | Contents | Next |

Managing the Dialog Box

This section gives details on the functions that the panel component must provide so that the sequence grabber can load the component's items into the settings dialog box and receive and process dialog events.

  1. To prepare to add the component's items to the settings dialog box, the sequence grabber obtains the item list by calling the SGPanelGetDITL function (described on SGPanelGetDITL ).
  2. Once it has installed the items, the sequence grabber calls the SGPanelInstall function (described on SGPanelInstall ), which sets up the state of the dialog box (for example, a checkbox) and gives the panel component an opportunity to set initial values.
  3. When the panel component is loaded into the settings dialog box and active, it may receive and process dialog events and mouse clicks. The component's SGPanelEvent function (described on SGPanelEvent ) processes individual dialog events.
  4. Whenever the user clicks a dialog item, the sequence grabber calls the SGPanelItem function (described on SGPanelItem ).
  5. Before the sequence grabber removes the items from the settings dialog box, it calls the SGPanelRemove function (described on SGPanelRemove ).

Listing 2 provides an example of the management of the settings dialog box for a sequence grabber that displays PICT images. The component item displayed in the dialog box in this case is a tick count checkbox.

Listing 2 Managing the settings dialog box

pascal ComponentResult PictPanelPanelGetDitl
                                                (PictPanelGlobals store,
                                                 Handle *ditl)
{
    /*
        Get and detach the dialog box template. Note that
        the sequence grabber has already opened the resource file.
    */
    *ditl = GetResource ('DITL', 7001);
    if (!*ditl) return resNotFound;
    DetachResource (*ditl);
    return noErr;
}

pascal ComponentResult PictPanelPanelInstall
                                (PictPanelGlobals store, SGChannel c,
                                 DialogPtr d, short itemOffset)
{
    Rect r;
    short kind;
    Handle h;
    Boolean ticksShowing;

    /* set up the initial state of the checkbox */
    GetDItem (d, 1 + itemOffset, &kind, &h, &r);
    store->ch = (ControlHandle)h;
    SGGetShowTickCount (c, &ticksShowing);
    SetCtlValue (store->ch, ticksShowing);

    return noErr;
}

pascal ComponentResult PictPanelPanelItem
                                (PictPanelGlobals store, SGChannel c,
                                 DialogPtr d, short itemOffset,
                                 short itemNum)
{
    /* if the item clicked was your checkbox, update its state */
    if ((itemNum - itemOffset) == 1) {
        Boolean showing = GetCtlValue (store->ch);
        SetCtlValue (store->ch, !showing);
        SGSetShowTickCount (c, !showing);
    }

    return noErr;
}

pascal ComponentResult PictPanelPanelRemove
                                        (PictPanelGlobals store,
                                        SGChannel c, DialogPtr d,
                                        short itemOffset)
{
    /* forget that it ever had a control */
    store->ch = nil;
    return noErr;
}

© 1999 Apple Computer, Inc.

Previous | Overview | Contents | Next